<template>
	<div class="index">

		<div class="center">
			<left></left>
			<div class="right">
          <top></top>
          <!-- <div class="hei10"></div>
          <div class="where" style="background: #fff; padding: 10px 30px; font-size: 14px; color: #595959;">当前位置：分销后台><router-link to="/order_productionzdsc" style="color: #409eff;">自动生产订单</router-link></div>
          --><div class="hei10"></div>


        <div class="team">
          <div class="powertop">
            <router-link class="powertopli powertopact" to="/order_productionzdsc">自动生产订单</router-link>
            <router-link class="powertopli " to="/order_productionzdsc/tidanbaobiao" v-if="shop_id == 304676 || shop_id == 50481 || shop_id == 301655">提单报表</router-link>
          </div>
        </div>
				<!-- 搜素 -->
        <div style="padding: 20px 20px 0;">
          <div class="kflex" style="margin-bottom: 20px;">
            <el-select  style="width:220px;margin-right:10px; margin-bottom:10px;"
            filterable
            v-model="searchform.channel_name"
            clearable filterable  placeholder="接口渠道  选择">
            	<el-option
            	v-for="(item,index) in qdList"
            	:key='index'
            	:label="item.user_defined_name" :value="item.channel_id"></el-option>
            </el-select>
            <el-select clearable style="width:220px;margin-right:10px; margin-bottom:10px;"  v-model="searchform.product_id" filterable  placeholder="产品  选择">
            	<el-option v-for="(item, index) in cpselect" :key="index" :label="item.name"
            	:value="item.id"></el-option>
            </el-select>
            <el-input v-model="searchform.product_sku" style="width:220px;margin-right:10px; margin-bottom:10px;" placeholder="产品编码"></el-input>
            <el-input  v-model="searchform.source" style="width:220px;margin-right:10px; margin-bottom:10px;" placeholder="订单来源(仅自己发展订单)"></el-input>

            <div style="position: relative;">
              <el-input v-model="searchform.id" style="width:220px;margin-right:10px; margin-bottom:10px;" placeholder="订单ID"></el-input>
              <el-tooltip class="item" effect="dark" content="批量查询" placement="top-start">
              	<span
              		style="position: absolute; right: 20px; top: 10px; color: #1989FA; font-size: 16px; cursor: pointer;"
              		@click="duoxuankai">
              		<i class="el-icon-circle-plus"></i>
              	</span>
              </el-tooltip>
            </div>
            <el-input v-model="searchform.source_id"  style="width:220px;margin-right:10px; margin-bottom:10px;" placeholder="外部订单编号"></el-input>
            <el-input v-model="searchform.plan_mobile_produced"  style="width:220px;margin-right:10px; margin-bottom:10px;" placeholder="生产号码"></el-input>
            <el-input v-model="searchform.address_mobile"  style="width:220px;margin-right:10px; margin-bottom:10px;" placeholder="联系电话"></el-input>

            <el-input v-model="searchform.id_card_num"  style="width:220px;margin-right:10px; margin-bottom:10px;" placeholder="身份证号"></el-input>
            <el-input v-model="searchform.upstream_order_id"  style="width:220px;margin-right:10px; margin-bottom:10px;" placeholder="上游单号"></el-input>
            <el-input v-model="searchform.tracking_number"  style="width:220px;margin-right:10px; margin-bottom:10px;" placeholder="物流单号"></el-input>
            <el-select  style="width:220px;margin-right:10px; margin-bottom:10px;"
            v-model="searchform.upstream_order_status"
            clearable  placeholder="上游订单状态  选择">
            	<el-option
            	value="-430" label="生产异常"></el-option>
            	<el-option
            	value="-460" label="开卡失败"></el-option>
            	<el-option
            	value="0" label="提交异常"></el-option>
            	<el-option
            	value="470" label="开卡中"></el-option>
            	<el-option
            	value="500" label="待发货"></el-option>
            	<el-option
            	value="550" label="已发货"></el-option>
            	<el-option
            	value="700" label="已激活"></el-option>

            </el-select>

            <el-date-picker type="datetimerange"
            v-model="longtime"
            :picker-options="pickerOptions"
            @change='changetime' :default-time="['00:00:00', '23:59:59']"
            value-format="yyyy-MM-dd HH:mm:ss"
            range-separator="至"
            	start-placeholder="开始日期" end-placeholder="结束日期" align="right">
            </el-date-picker>
          </div>
        </div>
        <div class="hei10" style="height: 1px;"></div>

				<div class="t_search_allbtn">
					<el-button round type="danger" @click="searchlist">搜索订单</el-button>

					<el-button round type="primary" plain @click="daochutishi = true"
					style='margin-right:10px' :loading="daochuing">{{daochuingz}}</el-button>

					<router-link to="/productionBasismanag/productionBasismanagDj">
						<el-button round type="primary" plain>配置自动生产></el-button>
					</router-link>
					<!-- v-if="shop_id=='304676'" -->
					<router-link   style="margin-left:10px" to="/order_productionzdsc/yc_productionzdsc">
						<el-button round type="danger" style="background: rgb(255, 154, 12) !important; border:0;" plain>异常订单自动处理></el-button>
					</router-link>
          <router-link   style="margin-left:10px" to="/order_productionzdsc/dizhiku" >
          	<el-button round type="danger" style="background: rgb(30, 170, 255) !important; border:0;" plain>地址库匹配规则管理 ></el-button>
          </router-link>
				</div>
				<div class="t_search_allbtn" style="margin-left: 10px;">
					<div  class="t_btn_box_all" >
						<upload-excel-component
						id="combtn"
						@on-selected-file="exportData" class="reloadup" :buttonName="export_data"></upload-excel-component>
					</div>

					<el-button @click="downDate" type="text" style="margin-right:10px;">下载导入模板</el-button>

          <el-select
          v-model="fixstatus"
          @change="moreflag"
          style="margin-left:10px;margin-right: 10px; width:220px;margin-right:20px;" placeholder="批量修改订单状态">
          	<el-option :label="item.label" :value="item.value" v-for="(item, index) in peizhis.order_status2"
          		:key="index"></el-option>

          </el-select>
					</div>
				<div v-if="daochutishi" style=" border: 1px #EAEAEA solid; margin: 0 20px; padding: 10px 10px; background: #fffcf3;margin-top:10px">
							<div style="font-size: 14px; margin-bottom: 10px; font-weight: bold; color: #333333;">为了给您提供更好的查询性能以及体验，我们对导出功能进行了更改：</div>
							<div style="padding-left: 20px; font-size: 14px; color: #666666; ">1.为了保证您的查询性能，两次导出的时间请间隔5分钟</div>
							<div style="padding-left: 20px; font-size: 14px; color: #666666; display: flex;  justify-content: space-between; align-items: center;">
								<div>2.我们将为您保留已生成的数据，便于您随时导出使用</div>
								<div>
									<el-button size="mini" type="primary" @click="xiazai">生成报表</el-button>
									<el-button size="mini" type="primary" @click="goxiazai">查看已经生成的报表</el-button>
								</div>
							</div>
						</div>
				<div class="t_content">
					<div class="t_tab_box" style="margin-bottom: 20px;">
						<div :class="nowactive == 1 ? 't_tab_lei' : ''" class="t_tab_item " @click="choosetab(1)">
							全部订单
						</div>

						<div :class="nowactive == 2 ? 't_tab_lei' : ''" class="t_tab_item" @click="choosetab(2)">提交异常({{abnormal_num}})
						</div>

						<div :class="nowactive == 3 ? 't_tab_lei' : ''" class="t_tab_item" @click="choosetab(3)">
							生产异常({{produce_abnormal_num}})
						</div>
					</div>
					<div style="margin-top:10px;margin-bottom:10px">
						<!-- <div  class="t_btn_box_all" v-if='nowactive == 1||nowactive == 3'>

							<upload-excel-component id="combtn"
							@on-selected-file="exportData" class="reloadup"
								buttonName="按导入再次提交上游">
							</upload-excel-component>
							<el-button @click="downshuadan2" type="primary" plain>下载导入模板</el-button>
						</div> -->

            <div  class="t_btn_box_all" v-if='nowactive == 1 && (shop_id == 50481 || shop_id == 304676)'>
              <div style="background: #F3F5F8; border-radius: 20px; margin-right: 20px; padding-right: 20px;" class="kflexc ">
                <upload-excel-component id="combtn"  style="border-radius: 20px;" @on-selected-file="exportData" buttonName="按导入修改订单信息且重新上传"></upload-excel-component>
                <div style="color: #333333; margin-left: 20px; font-size: 12px; cursor: pointer;" @click="downDate2">下载模板</div>
              </div>
            </div>

						<div  class="t_btn_box_all" v-if='nowactive == 2 && shop_id != 585402'>
							<el-button
							type="primary"
							@click='dcorder' round
							plain>导出异常订单</el-button>
							<!-- <el-button
							@click="repetup"
							type="primary" plain>重新提交上游</el-button> -->
							<upload-excel-component id="combtn"
							@on-selected-file="exportData" class="reloadup" style="border-radius: 20px;"
								buttonName="按导入重新提交上游">
							</upload-excel-component>
							<el-button @click="downshuadan2" type="text" round plain>下载导入模板</el-button>
              <!-- <el-button @click="downshuadan2" type="danger" plain>按导入修改订单信息且重新上传</el-button> -->
              <upload-excel-component
              id="combtn"  style="border-radius: 20px;"
              @on-selected-file="exportData" class="reloadup" buttonName="按导入修改订单信息且重新上传"></upload-excel-component>
              <el-button @click="downDate2" type="text" round plain style="margin-right:10px;">下载导入修改订单信息且重新上传模板</el-button>
						</div>

					</div>
					<div class="t_headbox">
						<div style="width:20%;text-align: left;">
							<input type="checkbox" @change="quanxuan" value="0"
							style="margin-left:10px;margin-right:10px"
							v-model="quanxuana">
							<span>订单信息</span>
						</div>
						<div style="width:25%">收件人信息
						</div>
						<div style="width:20%">订单状态
						</div>
						<div style="width:10%">
							失败原因</div>
						<div style="width:15%">生产信息</div>
						<div style="width:10%">操作</div>
					</div>
					<div v-for="(item, index) in datalist" :key="index" class="t_list_item">
						<div class="t_item_top" style="position: relative;">
							<div style="display: flex;align-items: center;">
								<input type="checkbox" :value="item.id" @change="danxuan"
												v-model="danxuans">
								订单ID：{{ item.id }}
								<i class="el-icon-document-copy"
									style="color: #077ECE; font-size: 16px; margin-left: 10px; cursor: pointer;margin-right: 20px;"
									@click="copys(JSON.stringify(item.id))"></i>
								订单来源：{{ item.source }}
								<i class="el-icon-document-copy"
									style="color: #077ECE; font-size: 16px; margin-left: 10px; cursor: pointer;margin-right: 20px;"
									@click="copys(item.source)"></i>
								外部订单号：{{ item.source_id }}
								<i class="el-icon-document-copy"
									style="color: #077ECE; font-size: 16px; margin-left: 10px; cursor: pointer;margin-right: 20px;"
									@click="copys(item.source_id)"></i>
								修改时间：{{ item.status_updated_at }}


							</div>
							<div v-if="nowactive == 2||nowactive == 3"
									@click="waihu(item.id)"
									style="cursor: pointer; display: flex;align-items: center;color:#EEF7FF;margin-left: 100px;position: absolute;top: 19px;right: 75px;">
									<img src="../../../static/img/wh333.png" style="margin-right: 10px;width: 20px; height: 20px;">外呼
								</div>
							<!-- <span style="color:#B7B7B7" class="iconfont icon-flag-fill"></span> -->
							<!-- <div class="newright" style="display: flex;">

										<el-tooltip popper-class="tooltip" effect="dark" placement="top">
											<div slot="content">{{item.memo}}</div>
											<div><span @click="choosecolorid(item.id,item.source_id)" :style="{color:item.flag,fontSize:25+'px'}" class="iconfont icon-flag-fill">
												</span></div>
										</el-tooltip>

									</div> -->
						</div>
						<div class="t_item_cont">
							<div class="t_item_box" style="width:20%;">
								<div>产品名称：{{ item.supplier_product_name }}</div>
								<div>
									商品编码：{{ item.my_gsku }}
								</div>
								<div>购买号码：{{ item.plan_mobile }}</div>
								<div>自动生产：{{ item.user_defined_name }}</div>
							</div>
							<div class="t_item_box" style="width:25%;">
								<div>证件姓名：{{ item.id_card_name }}</div>
								<div>收货人：{{item.address_name}}</div>
								<div>证件号码：{{ item.id_card_num }}</div>
								<div>联系电话：{{ item.address_mobile }}</div>
								<div>收货地址：{{ item.address_province }}
									{{ item.address_city }}
									{{ item.address_district }}
									{{ item.address }}
								</div>
								<el-button
								@click="jiemi(item)"
								type="text"  v-if="user.id != 304673 && user.id != 304672 && user.id != 50481">查看完整信息</el-button>
								<el-button
								v-if="nowactive != 3 && user.id != 304673 && user.id != 304672 && user.id != 50481"
								@click="seephoto(item)"
								type="text">修改照片</el-button>
							</div>
							<div class="t_item_box" style="width:20%;">
								<div>上游状态:{{item.upstream_order_status_name}}:{{item.upstream_order_time}}
								<el-button v-if="nowactive != 3" @click="openxg(item.upstream_id)" type="text">修改</el-button>
								<!-- <el-button @click="openqrsb(item.upstream_id,'-460')" type="text">确认上游订单失败</el-button> -->
								<!-- <el-button @click="openqrsb(item.upstream_id,'470')" type="text">确认上游订单成功</el-button> -->
								</div>
								<div>上游订单号:{{item.upstream_order_id}}</div>
								<!-- <div v-html='changestr(item.producer_memo)'></div> -->

								<div>{{moban.platform_name}}状态:{{ item.status_name }}</div>
								<div>激活状态：{{ item.active_name }}</div>
								<el-button @click="openczjl(item.producer_memo)" type="text">操作记录</el-button>
							</div>
							<div class="t_item_box" style="width:10%;">
								<div>{{ item.upstream_order_reason }}</div>
							</div>
							<div class="t_item_box" style="width:15%;">
								<div>生产号码:{{item.plan_mobile_produced}}

								</div>
								<div>物流公司:{{item.tracking_company}}
								</div>
								<div>物流单号:{{item.tracking_number}}</div>
							</div>
							<div class="t_item_box" style="width:10%;text-align: center;border-right: none;">
								<!-- <el-button @click="seedetail(item.id)" type="text"  v-if="user.id != 304673 && user.id != 304672">查看详情</el-button><br /> -->
                <div style="color: #409EFF; text-align: center; cursor: pointer;" class="seebtn" @click="orderdetailkai(item)"  v-if="user.id != 304673 && user.id != 304672">查看详情</div>
								<el-button v-if='nowactive!=3'  @click="openlrscsj(item.id)" type="text">录入生产数据</el-button>
                <br v-if='nowactive!=3  && item.wu' />
								<el-button v-if='nowactive!=3 && item.wu'  @click="openxgzt(item.id)" type="text">修改状态</el-button>
                <br v-if='nowactive!=3 && item.wu' />
								<el-button v-if="item.wu" @click="openxgddxx(item.id,item.source_id)" type="text">修改订单信息</el-button>
								<el-button
									v-if='nowactive==2'
									@click="newchongxintijiao(item.id,item.channel_id,item.upstream_order_reason,1,item.upstream_id)"  type="text">确认订单失败</el-button><br />
								<!-- <div v-if="shop_id=='304676'">

									<el-button
									v-if='nowactive==2'
									@click="newchongxintijiao(item.id,item.channel_id,item.upstream_order_reason,1,item.upstream_id)"  type="text">确认订单失败</el-button><br />
									<el-button
									v-if='nowactive==2||nowactive==3'
									@click="newchongxintijiao(item.id,item.channel_id,item.upstream_order_reason,2)"  type="text">重新提交至上游</el-button>
								</div> -->
								<!-- <div v-else>

								</div>  -->
								<el-button
									v-if='nowactive==2||nowactive==3'
									@click="chongxintijiao(item.id,'')"  type="text">重新提交至上游</el-button>
								<el-button
								v-if='nowactive==1'
								@click="qzupdata(item.id)" type="text">再次提交上游</el-button>
								<el-button
								v-if="item.is_auto_photo==1"
								@click="repeatphone(item.id)" type="text">重新上传照片</el-button>
								<el-button v-if='nowactive==3' @click="openqrsb(item.upstream_id,'-460')" type="text">确认失败</el-button>
                <el-button @click="baowen(item.id,0)" type="text">接口报文</el-button>
							</div>
						</div>
					</div>
					<div class='t_fybox' style="text-align:center;margin-top:20px">
						<el-pagination
							background
							layout="prev, pager, next,sizes"
							:current-page="searchform.page"
							@current-change="changepage"
							@size-change="handleSizeChange"
							:page-size="searchform.page_size"
              :page-sizes="[20, 50, 100, 200,500,1000]"
							:total="totalall">
						</el-pagination>
					</div>

				</div>
			</div>
		</div>
		<!-- <foot></foot> -->
		<!-- 操作记录 -->
		<el-dialog center title="操作记录" :visible.sync="czjlshow" width="800px">
			<div v-html='czjltext'></div>

		</el-dialog>
		<!-- 确认失败 -->
		<el-dialog center title="确认失败" :visible.sync="qrsbshow" width="600px">
			<div class="t_myform">
				<div>备注原因：</div>
				<el-input v-model="remark" style="width: 350px;" placeholder="请输入内容"></el-input>
			</div>
			<div class="t_myform">
				<div>快速原因：</div>
				<el-button @click="remark = '手持照片不合格'" style="margin-top:10px" type="info">手持照片不合格</el-button>
				<el-button @click="remark = '长得太帅。。。'" style="margin-top:10px" type="info">长得太帅。。。</el-button>
				<el-button @click="remark = '心情不好'" style="margin-top:10px" type="info">心情不好</el-button>
				<el-button @click="remark = '手持照片不合格'" style="margin-top:10px" type="info">手持照片不合格</el-button>
			</div>
			<div class="t_cz_btnbox">
				<el-button @click="tjqrsb"  type='danger' round >确定</el-button>
			</div>
		</el-dialog>
		<!-- 录入生产数据 -->
		<el-dialog center title="录入生产数据" :visible.sync="lrscsjshow" width="600px">
			<div class="t_myform">
				<div class="t_myform_title">生产号码:</div>
				<el-input v-model="chooseorderlist.plan_mobile_produced" style="width: 350px;" placeholder="请输入内容">
				</el-input>
			</div>
			<div class="t_myform">
				<div class="t_myform_title">物流公司:</div>
				<el-select v-model="chooseorderlist.tracking_company_id" @change="wuliuchange" style="width: 350px;"
					placeholder="请选择活动区域">
					<el-option v-for="item in trackCompanyList" :key="item.id" :label="item.company" :value="item.id">
					</el-option>
				</el-select>
			</div>
			<div class="t_myform">
				<div class="t_myform_title">运单号:</div>
				<el-input v-model="chooseorderlist.tracking_number" :disabled="wuliu0" style="width: 350px;"
					placeholder="请输入内容">
				</el-input>
			</div>

			<div class="t_cz_btnbox">
				<el-button @click="tjlrscsj"  type='danger' round >确定</el-button>
			</div>
		</el-dialog>
		<!-- 修改订单状态 -->
		<el-dialog center
		title="强制修改订单提交状态"
		:visible.sync="xgshow"
		width="600px">
			<div>
				<div><el-radio v-model="qzradio" label="1">提交成功</el-radio></div>
				<br>
				<div style="color:#abaaaa">修改为"提交成功"订单会从"提交异常"中消失，视为已成功提交</div>
				<br><br>
				<div><el-radio v-model="qzradio" label="2">提交失败</el-radio></div>
				<br>
				<div style="color:#abaaaa">修改为”提交失败”视为放弃提交，订单状态会变更为生产失败，
订单发展方可在订单处理-生产失败处处理订单。</div>
			</div>
			<div class="t_cz_btnbox">
				<el-button @click="upqzxg"  type='danger' round >确定</el-button>
			</div>
		</el-dialog>
		<!-- 修改状态 -->
		<el-dialog center title="修改状态" :visible.sync="xgztshow" width="600px">
			<div class="t_myform">
				<div class="t_myform_title">选择状态:</div>
				<el-select v-model="updatedS" style="width: 350px;" placeholder="请选择状态">
					<el-option style="width:100%" :label="item.label" :value="item.value"
						v-for="(item, index) in peizhis.order_status2" :key="index"></el-option>
				</el-select>
			</div>
			<div class="t_myform">
				<div class="t_myform_title">备注原因:</div>
				<el-input v-model="remarks" style="width: 350px;" placeholder="请输入内容"></el-input>
			</div>
			<div class="t_cz_btnbox">
				<el-button @click="tjxgzt"  type='danger' round >确定</el-button>
			</div>
		</el-dialog>
		<!-- 修改订单信息 -->
		<el-dialog center title="修改订单信息" :visible.sync="xgddxxshow" width="510px">
			<div class="t_myform">
				<div class="t_myform_title">收货人:</div>
				<el-input v-model="noworder.address_name" style="width: 350px;" placeholder="请输入内容"></el-input>
			</div>
			<div class="t_myform">
				<div class="t_myform_title">身份证姓名:</div>
				<el-input v-model="noworder.id_card_name" style="width: 350px;" placeholder="请输入内容"></el-input>
			</div>
			<div class="t_myform">
				<div class="t_myform_title">身份证号:</div>
				<el-input v-model="noworder.id_card_num" style="width: 350px;" placeholder="请输入内容"></el-input>
			</div>
			<div class="t_myform">
				<div class="t_myform_title">联系电话:</div>
				<el-input v-model="noworder.address_mobile" style="width: 350px;" placeholder="请输入内容"></el-input>
			</div>

			<div class="t_myform">
				<div class="t_myform_title">收货地址:</div>
				<el-cascader clearable style="width: 350px;" v-model="selectedOptions" size="large"
					@change="handleChange" :options="areaoptions"></el-cascader>
				<span style="margin-left:100px;color:#409EFF;cursor:pointer" @click="handssq = true">没找到？手动填写</span>
			</div>
			<div v-if='handssq' class="t_myform">
				<div class="t_myform_title">手动填写:</div>
				<el-input v-model="noworder.address_province" style="width: 110px;" placeholder="请输入内容"></el-input>
				<el-input v-model="noworder.address_city" style="width: 110px;margin-left:10px;margin-right:10px"
					placeholder="请输入内容"></el-input>

				<el-input v-model="noworder.address_district" style="width: 110px;" placeholder="请输入内容"></el-input>
			</div>

      <div class="t_myform">
      	<div class="t_myform_title">镇:</div>
      	<el-input v-model="noworder.town" style="width: 350px;" placeholder="请输入镇"></el-input>
      </div>
			<div class="t_myform">
				<div class="t_myform_title">详细地址:</div>
				<el-input v-model="noworder.address" style="width: 350px;" placeholder="请输入内容"></el-input>
			</div>
			<div style="padding-left: 20px;" v-if="amountchai.indexOf('-C') != -1">
				<span style="color: #DD2727;">注：</span>
				当前订单为拆分订单（电商平台购买数量大于2时自动拆分订单）该操作将同步修改其它拆分关联订单的订单信息。
				<span>
					<el-checkbox v-model="tongbu">同步修改</el-checkbox>
				</span>
			</div>
       <div class="kflexc" style="justify-content: end; margin-bottom: 20px;" v-if="shop_id == 304676 || shop_id == 50481">
         <div style="margin-right: 20px;"><el-button @click="baocunmoren" size="small" type='primary' plain round >保存本次修改至默认规则</el-button></div>
         <div>
           <el-tooltip class="item" effect="light" :tabindex="20000" content="保存后，再次遇到同样的地址问题会按照该次规则自动修改提单，避免人工重复处理" placement="top">
           	<i class="el-icon-question" style="color: #409EFF; font-size: 24px;"></i>
           </el-tooltip>
         </div>
       </div>
			<div class="t_cz_btnbox">
				<!-- 提交异常显示 -->
				<el-button  @click="tjxgddxxandtjsy"  type='danger' round >保存并提交至上游</el-button>
				<el-button @click="tjxgddxx"  type='danger' round >保存</el-button>
			</div>
		</el-dialog>
		<!-- 导入结果 -->
		<el-dialog center title="导入结果" :visible.sync="daorulog" width="600px" :close-on-click-modal="false">
			<div v-loading='daoruing'>
				<div style="color: #229453; font-size: 16px; padding-bottom: 20px;" v-if="daorulist.length==0">全部成功！</div>
				<div v-else style="color: #f00; font-size: 16px; padding-bottom: 20px; line-height: 30px;">失败及原因：
					<div v-for="item in daorulist" :key="item" style="padding-left: 20px;">
						{{ item }}
					</div>
				</div>
			</div>
			<span slot="footer" class="dialog-footer">
				<el-button  type='danger' round  @click="daorulog = false">好的</el-button>
			</span>
		</el-dialog>
		<!-- 重新上传照片 -->
		<el-dialog center title="重新上传照片" :visible.sync="seephotolog2" :close-on-click-modal="false" width="1254px">
			<div >
				<div style="display: flex; justify-content: flex-end; width: 99%; ">
					<div class="copyBtn" v-if="urlStatus && can_upload" @click="copyurl">
						{{urlStatus==='photos'?'复制订单专属照片上传连接':'复制专属证件信息上传链接'}}</div>
				</div>
				<div class="logflex" v-if="!urlStatus">该订单无需证件信息</div>
				<div class="logflex" v-if="urlStatus === 'idcodenum' && !can_upload">该订单当前状态不支持修改证件信息。如需修改，请联系生产</div>
				<div class="logflex" v-if="urlStatus==='photos'">
					<div class="proimg" v-if="choose.face != ''">
						<img :src="choose.face" />
					</div>
					<div class="proimg" v-if="choose.face == ''">暂无照片</div>
					<div class="proimg" v-if="choose.back != ''">
						<img :src="choose.back" />
					</div>
					<div class="proimg" v-if="choose.back == ''">暂无照片</div>
					<div class="proimg" v-if="choose.hand != ''">
						<img :src="choose.hand" />
					</div>
					<div class="proimg" v-if="choose.hand == ''">暂无照片</div>
					<div class="protitle" v-if="waitpic && can_upload">
						<el-upload class="upload-demo" :show-file-list="false"
							action="https://jsonplaceholder.typicode.com/posts/" :on-change="uploadok"
							:auto-upload="false">
							<el-button  type='danger' round  @click="fixchoose('face')">修改正面照片</el-button>
						</el-upload>
					</div>
					<div class="protitle" v-if="waitpic && can_upload">
						<el-upload class="upload-demo" :show-file-list="false"
							action="https://jsonplaceholder.typicode.com/posts/" :on-change="uploadok"
							:auto-upload="false">
							<el-button  type='danger' round  @click="fixchoose('back')">修改反面照片</el-button>
						</el-upload>
					</div>
					<div class="protitle" v-if="waitpic && can_upload">
						<el-upload class="upload-demo" :show-file-list="false"
							action="https://jsonplaceholder.typicode.com/posts/" :on-change="uploadok"
							:auto-upload="false">
							<el-button  type='danger' round  @click="fixchoose('hand')">修改免冠照片</el-button>
						</el-upload>
					</div>
				</div>
				<div class="idCarda" v-if="urlStatus && can_upload">
					<el-form ref="zhengjian" @submit.native.prevent :model="choose" label-width="110px">
						<div class="flex" style="margin-top: 40px;justify-content: center;align-items: center;">
							<el-form-item label="证件姓名">
								<el-input v-model="choose.id_card_name" @blur="changeIdCardMsg"></el-input>
							</el-form-item>
							<el-form-item label="身份证号码:">
								<el-input v-model="choose.id_card_num" @blur="changeIdCardMsg"></el-input>
							</el-form-item>
							<div style="margin-left: 10px;" v-if="urlStatus==='photos'">
								<el-button  type='danger' round  @click="getIdCardMsgByAI" >智能识别填充证件信息</el-button>
							</div>
						</div>
					</el-form>
				</div>
			</div>

			<span slot="footer" class="dialog-footer" style="display: flex;justify-content: center;"
				v-if="urlStatus && can_upload">


				<el-button  type='danger' round  @click="reppicgo"  v-if="waitpic  && func_I02">提交至初审
				</el-button>

			</span>
		</el-dialog>
		<el-dialog center title="标旗设置" :close-on-click-modal="false" :visible.sync="flaglog" width="600px">
					<div style="display: flex;">
						<div style=" padding:0 20px; position: relative; top: 5px; ">标旗：</div>
						<el-radio-group v-model="flagradio" style="display: flex;">

							<el-tooltip style="margin-right: 20px;" popper-class="tooltip" effect="dark" placement="top" v-for="item in flaglist"
							 :key="item.id">
								<div slot="content">{{item.flag}}</div>
								<div>
									<el-radio :label="item.type"><span :style="{color:item.color,fontSize:25+'px'}" class="iconfont icon-flag-fill">
										</span></el-radio>
								</div>
							</el-tooltip>

						</el-radio-group>
					</div>
					<div style="display: flex; margin-top: 20px; width: 530px;">
						<div style=" padding:0 20px; position: relative; top: 5px; width: 100px;">修改备注：</div>
						<el-input type="textarea" :rows="3" placeholder="请输入备注" v-model="flagarea"></el-input>
					</div>
					<div style="padding-left: 20px; padding-top: 20px;" v-if="amountchai.indexOf('-C') != -1"><span style="color: #DD2727;">注：</span>当前订单为拆分订单（电商平台购买数量大于2时自动拆分的订单）该操作将同步修改其它拆分关联订单的备注。</div>
					<span slot="footer" class="dialog-footer">
						<el-button  type='danger' round  @click="flagloggo">确定</el-button>
					</span>
				</el-dialog>
				<el-dialog title="请输入导出密码" :visible.sync="mimalog" width="400px" :close-on-click-modal="false">
					<div style="padding-right: 30px;">
						<el-input v-model="mima" show-password placeholder="请输入导出密码"></el-input>
					</div>
					<div slot="footer" class="dialog-footer">
						<el-button  type='danger' round  @click="mimaqueren">确 定</el-button>
						<el-button  type='danger' round  @click="mimachongzhilog = true">重设密码</el-button>
					</div>
				</el-dialog>
				<el-dialog title="请设置导出密码" :visible.sync="mimasetlog" width="400px" :close-on-click-modal="false">
					<!--              <div style="padding-right: 30px; margin-bottom: 20px;">
                   <el-input v-model="mimashoujihao" disabled placeholder="请输入验证码"></el-input>
              </div>
              <div style="padding-right: 30px; margin-bottom: 20px; position: relative;">
                   <el-input v-model="mimacode"  placeholder="请输入验证码"></el-input>
                   <el-button style="padding: 9px 30px; position: absolute; right: 31px; top: 1px;"  type="danger" @click="getcode" :disabled="jinyong" size="mini">{{tishi}}</el-button>
              </div> -->
					<div style="padding-right: 30px; margin-bottom: 20px;">
						<el-input v-model="mimaset" show-password placeholder="请设置导出密码"></el-input>
					</div>
					<div style="padding-right: 30px;">
						<el-input v-model="mimaset2" show-password placeholder="请再次输入确认导出密码"></el-input>
					</div>
					<div style="color: #DF3434; margin-top: 10px;">为了您的订单数据安全，即日起所有批量导出数据的出口需输入导出密码才可导出，请与联系店铺负责人协商设置该密码</div>

					<div slot="footer" class="dialog-footer">
						<el-button  type='info' round  @click="mimasetlog = false">取 消</el-button>
						<el-button  type='danger' round  @click="mimasetqueren">确 定</el-button>
					</div>
				</el-dialog>
		<el-dialog center title="重设密码" :visible.sync="mimachongzhilog" width="400px" :close-on-click-modal="false">
					<div style="padding-right: 30px; margin-bottom: 20px;">
						<el-input v-model="mimashoujihao" disabled placeholder="请输入验证码"></el-input>
					</div>
					<div style="padding-right: 30px; margin-bottom: 20px; position: relative;">
						<el-input v-model="mimacode" placeholder="请输入验证码"></el-input>
						<el-button style="padding: 9px 30px; position: absolute; right: 31px; top: 1px;" type="danger" @click="getcode"
						 :disabled="jinyong" size="mini">{{tishi}}</el-button>
					</div>
					<div style="padding-right: 30px; margin-bottom: 20px;">
						<el-input v-model="mimaset" show-password placeholder="请输入新密码"></el-input>
					</div>
					<div style="padding-right: 30px;">
						<el-input v-model="mimaset2" show-password placeholder="请确认新密码"></el-input>
					</div>
					<div slot="footer" class="dialog-footer">
						<el-button  type='info' round  @click="mimachongzhilog = false">取 消</el-button>
						<el-button  type='danger' round  @click="mimaqueren2">确 定</el-button>
					</div>
				</el-dialog>
				<el-dialog center
					:title="newtitle"
					:visible.sync="newcxtjzsy"
					width="600px">
					<span v-if="newtype==1" >确认订单生产失败后订单将会打回给发展方处理</span>
					<span v-if="newtype==2" >确定重新至上游吗？确定后订单将会在60分钟后重新提交至上游</span>
					<el-checkbox style="margin-top:30px;color: #8e8e8e;font-weight:normal" @change="changect" v-model="autocx">
						<span v-if="newtype==1" >该类型失败原因的订单以后自动按“自动生产失败”处理</span>
						<span v-if="newtype==2" >该类型失败原因的订单以后自动按“重新提交至上游”处理</span>
					</el-checkbox>
					<span slot="footer" class="dialog-footer">
						<el-button  type='info' round @click="newcxtjzsy = false">取 消</el-button>
						<el-button  type='danger' round  @click="sureset(newcxid,channel_id)">确 定</el-button>
					</span>
				</el-dialog>
				<el-dialog center
				title="确认创建规则"
				:visible.sync="cjgz"
				width="600px">
				<span>勾选该选项后以后此产品接口渠道返回的失败原因为<span style="color: #2974FF;">'{{newsbreason}}'</span>的订单将会自动以“<span v-if="newtype==1">生产失败</span><span v-if="newtype==2">重新提交至上游</span>”处理，您可在该页面<span style="color: #E6A23C;">橙色‘异常订单自动处理’按钮</span>处修改该设置</span>
				<span slot="footer" class="dialog-footer">
					<el-button  type='danger' round  @click="cjgz=false" >确 定</el-button>
				</span>
				</el-dialog>

        <el-dialog center :title="baowendingdan + baowencon.channel_name + '自动生产接口报文'" :visible.sync="baowenlog" width="700px" :close-on-click-modal="false">
        	<div>
            <div style="font-size: 16px; margin-bottom: 30px;">提交接口:{{baowencon.channel_name}}</div>

            <el-tabs v-model="activeName" @tab-click="handleClick">
                <el-tab-pane label="提单报文" name="first">
                  <div style="display: flex;  font-size: 14px;" v-for="(item,index) in baowencon.data" :key="index">
                    <div style="margin-right: 30px;">{{item.created_at}}</div>
                    <div style="max-width: 400px;">
                      <div style="margin-bottom: 10px;">{{item.status_name}}</div>
                      <div v-html="item.show"></div>
                    </div>
                  </div>
                </el-tab-pane>
                <el-tab-pane label="查单报文" name="second">
                  <div style="display: flex;  font-size: 14px;" v-for="(item,index) in baowencon.data" :key="index">
                    <div style="margin-right: 30px;">{{item.created_at}}</div>
                    <div style="max-width: 400px;">
                      <div style="margin-bottom: 10px;">{{item.status_name}}</div>
                      <div v-html="item.show"></div>
                    </div>
                  </div>
                </el-tab-pane>
                <el-tab-pane label="回调报文" name="third">
                  <div style="display: flex;  font-size: 14px;" v-for="(item,index) in baowencon.data" :key="index">
                    <div style="margin-right: 30px;">{{item.created_at}}</div>
                    <div style="max-width: 400px;">
                      <div style="margin-bottom: 10px;">{{item.status_name}}</div>
                      <div v-html="item.show"></div>
                    </div>
                  </div>
                </el-tab-pane>
            </el-tabs>
          </div>
        	<div slot="footer" class="dialog-footer">
        		<el-button type='danger' round @click="baowenlog = false">确 定</el-button>
        	</div>
        </el-dialog>

        <piliangsousuo :title="'批量ID'" ref="duoxuan" @qusousuo="qusousuo">

        </piliangsousuo>
        <orderDetail v-if="orderdetailall.show" ref="orderdetailalllog" @guanbi="guanbi" :id="orderdetailall.id"></orderDetail>
        <el-dialog center  title="保存规则成功"  :visible.sync="baocunguizelog"  width="600px">
          <div style="color: rgb(117, 117, 117); line-height: 35px;">
            已成功保存至默认规则，之后再次该地址匹配问题后，系统会自动按照此次规则修改，您可在 “设置” —— <span style="color: rgb(57, 91, 255); cursor: pointer;" @click="go('/guizedizhiku')">“地址库匹配规则管理”</span> 处编辑规则
          </div>
          <span slot="footer" class="dialog-footer">
            <el-button  type='danger' round  @click="baocunguizelog = false" >确 定</el-button>
          </span>
        </el-dialog>

	</div>
</template>

<script>

import orderDetail from "./Azujian/orderDetail.vue";
import top from "@/components/top.vue";
import left from "@/components/left.vue";
import foot from "@/components/foot.vue";
import UploadExcelComponent from "@/components/UploadExcel/index.vue";
import piliangsousuo from "./Azujian/piliangsousuo"
import {
	regionData,
	CodeToText,
	TextToCode
} from 'element-china-area-data'
import axios from "axios";
import router from "@/router";
import moment from 'moment'

export default {
	components: {
		left: left,
		top: top,
		foot: foot,
		UploadExcelComponent,
    piliangsousuo,orderDetail
	},
	name:'order_productionzdsc',
	data() {
		return {
      orderdetailall:{
        id:"",
        show:false
      },
      duoxuanlog:false,
			xgshow:false,
			qzradio:'',
			qzchangeid:'',
			pickerOptions: {
				shortcuts: [{
					text: '最近一周',
					onClick(picker) {
						const end = new Date();
						const start = new Date();
						start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
						picker.$emit('pick', [start, end]);
					}
				}, {
					text: '最近一个月',
					onClick(picker) {
						const end = new Date();
						const start = new Date();
						start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
						picker.$emit('pick', [start, end]);
					}
				}, {
					text: '最近三个月',
					onClick(picker) {
						const end = new Date();
						const start = new Date();
						start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
						picker.$emit('pick', [start, end]);
					}
				}]
			},
			//当前tab
			nowactive: 1,
			//列表数据
			datalist: [],
			//操作记录弹窗
			czjlshow: false,
			//确认失败弹窗
			qrsbshow: false,
			//录入生产数据
			lrscsjshow: false,
			//修改状态弹窗
			xgztshow: false,
			//修改订单信息弹窗
			xgddxxshow: false,
			//地区
			areaoptions: regionData,
			//是否显示手动填写
			handssq: false,
			//产品下拉
			cpselect: [],
			//搜索
			// searchform: {
			// 	cp: '',
			// 	page_size:20
			// },
			//当前操作对象id
			currentId: '',
			//失败备注原因
			remark: "",
			//物流公司下拉
			trackCompanyList: [],
			//渠道下拉
			qdList: [],
			//生产数据
			chooseorderlist: {
				plan_mobile_produced: '',
				tracking_company_id: '',
				tracking_number: ''
			},
			//是否需要物流
			wuliu0: false,
			//选择状态
			updatedS: '',
			//修改状态备注
			remarks: "",
			//信息地址数据
			noworder: {
				id: '',
				same: '',
				address_name: '',//收货人：
				id_card_name: '',//身份证姓名：
				id_card_num: '',//身份证号：
				address_mobile: '',//联系电话：
				address_province: '',//手动填写：省
				address_city: '',//手动填写：市
				address_district: '',//手动填写：区
				address: '',//详细地址：
				address_province_code: '',
				address_city_code: '',
				address_district_code: '',
        town:""
			},
			//是否为拆单
			amountchai: '',
			//是否同步
			tongbu: false,
			//地区选择
			selectedOptions: [],
			// 导出结果弹窗
			daorulog: false,
			daoruing: false,
			// daoruok: 0,
			daorulist: [],
			//操作记录
			czjltext:'',
			//搜索
			searchform: {
				channel_name:'',//渠道名
				product_id:'',//产品名
				product_sku:'',//产品编码
				source:'',//订单来源
				id:'',//订单id
				source_id:'',//外部订单号
				plan_mobile_produced:'',//生产号码
				address_mobile:'',//联系电话
				id_card_num:'',//身份证号
				upstream_order_id:'',//上游订单号
				tracking_number:'',//物流单号
				upstream_order_status:'',//上游订单异常
				start_time:'',//开始时间
				end_time:'',//结束时间
				flag:'',//空是全部，1是异常
				password:'',
				page:1,//页码
				page_size:20//数量
			},
			//时间段
			longtime:[],
			//全部订单数量
			totalall:'',
			//查看照片弹窗
			seephotolog2: false,
			urlStatus: false, //控制复制链接
			can_upload: false, //能否上传照片
			quanxuana: false,
			danxuans: [],
			quanxuans: [],
			fixstatus:'',
			abnormal_num:null,//异常数据数量
			produce_abnormal_num:null,
			choose:{
				id:'',
				face:'',
				back:'',
				hand:'',
				id_card_name:'',
				id_card_num:'',
			},
			scsource_id:'',
			waitpic: false,
			func_I02: false,
			upstream_id:'',
			suretype:'',
			flaglog: false,
			chooseid: "",
			flagradio: 0,
			flagarea: "",
			flaglist: [],
			color: "",
			daochuing: false,
			daochuingz: "导出信息",
			daochutishi: false,
			mimasetlog: false,
			mimalog: false,
			mimaset: "",
			mimaset2: "",
			mimashoujihao: "",
			mimacode: "",
			count: 60,
			tishi: "获取验证码",
			mimachongzhilog: false,
			jinyong: false,
			mima: "",
			export_data: "上游订单处理",
			newsbreason:'',
			newcxtjzsy:false,
			newcxid:'',
			autocx:null,
			cjgz:false,
			channel_id:'',
			newtype:'',//1确认失败，2重新提交
			newtitle:'',
			shop_id:'',
      baowenlog:false,
      baowencon:"",
      baowendingdan:"",
      activeName:"first",
      ischange:0,
      user:"",
      old:"",
      baocunguizelog:false,

		};
	},
	created() {
		axios.get('/api/gth/user/shop')
		.then(response => {
			if(response.data.msg.code == 0){
				this.shop_id = response.data.data.shop_id
				// 304676
				console.log('------')
				console.log(this.shop_id)
			}else{
				if(response.data.msg.code == 50401){that.$router.push({ path: "/login" }); return false}
				that.$message.error(response.data.msg.info);
			}
		})
		//地址配置,用于下载模板
			if (window.location.href.indexOf("91haoka_platform") > -1) {
				console.log("线上项目，谨慎操作。")
				this.url = window.location.origin + "/91haoka_platform/"
			} else {
				this.url = ""
			}
		//获取所有产品下拉
		this.getcpselect()
		//获取物流公司
		this.getTrackCompany()
		//获取渠道下拉
		this.getqdselect()
		//获取全部列表
		this.getlist()
		//获取旗
		this.getflag();
		//设置默认时间
		this.getDefaultTime()
		//权限问题
		var user = JSON.parse(localStorage.getItem("USER"));
		this.user = user
		this.user_func = user.functions;
		for (var i in this.user_func) {
			var func_number = this.user_func[i].code;
			if (func_number.indexOf("I02") >= 0) {
				this.func_I02 = true;
			}
			if (func_number.indexOf("L") >= 0 || func_number.indexOf("l04") >= 0) {
				this.l04 = true;
			}

		}
		this.getshoujihao()
    this.getshu()
	},
	methods: {
    getshu:function(){
      axios.get("/api/gth/upstream/order/anomalous/nums")
      	.then(response => {
      		if (response.data.msg.code == 0) {
      			this.abnormal_num=response.data.data.anomalous_num
      			this.produce_abnormal_num=response.data.data.produce_anomalous_num
      		} else {
      			this.$message.error(response.data.msg.info);
      		}
      	})
    },
    guanbi:function(){
      this.orderdetailall.show = false
    },
    orderdetailkai:function(val){
      this.orderdetailall.id = val.id
      this.orderdetailall.show = true
      this.$nextTick(()=>{
        this.$refs.orderdetailalllog.chushihua()
      })
    },
    baocunmoren:function(){
      axios.post('/api/plan-market/order/address/add', {
      	order_id:this.currentId,
        //新
        sub_province:this.noworder.address_province,
        sub_city:this.noworder.address_city,
        sub_district:this.noworder.address_district,
        //老
        address_province:this.old.address_province,
        address_city:this.old.address_city,
        address_district:this.old.address_district,
      })
      .then(response => {
        if (response.data.msg.code == 0) {
        	this.$message.success('规则已保存');
          this.baocunguizelog = true
          console.log(this.baocunguizelog)
        } else {
        	this.$message.error(response.data.msg.info);
        }
      })
    },
    duoxuankai:function(){
      this.$refs.duoxuan.log = true
    },
    qusousuo:function(ids){
      this.searchform.id = ids
      this.getlist()
    },
    handleClick(tab, event) {

        if(this.activeName == 'first'){
          this.baowen(this.baowendingdan,0)
        }
        if(this.activeName == 'second'){
          this.baowen(this.baowendingdan,1)
        }
        if(this.activeName == 'third'){
          this.baowen(this.baowendingdan,2)
        }

    },
    baowen:function(id,type){
      this.activeName = 'first'

      this.baowendingdan = id
      axios.get('/api/plan-market/auto/produce/log', {
      	params: {
          id:id,
          type:type
        }
      })
      .then((response) => {
        if (response.data.msg.code == 0) {
        	this.baowencon = response.data.data
          this.baowenlog = true
        } else {
        	this.$message.error(response.data.msg.info);
        }
      })
    },
		//修改每页条数
		handleSizeChange(val) {
			console.log(`每页 ${val} 条`);
			this.searchform.page_size=val
			this.searchform.page=1
			//获取全部列表
			this.getlist()
		},
		//获取全部列表
		getlist() {
			axios.get('/api/plan-market/upstream/order/list', {
				params: this.searchform
			})
				.then((response) => {
					console.log(response)
					for (var i = 0; i < response.data.data.data.length; i++) {
								if (response.data.data.data[i].flag == 0) {
									response.data.data.data[i].flag = "#e4dfd7"
								}
								if (response.data.data.data[i].flag == 1) {
									response.data.data.data[i].flag = "#ee3f4d"
								}
								if (response.data.data.data[i].flag == 2) {
									response.data.data.data[i].flag = "#ebb10d"
								}
								if (response.data.data.data[i].flag == 3) {
									response.data.data.data[i].flag = "#229453"
								}
								if (response.data.data.data[i].flag == 4) {
									response.data.data.data[i].flag = "#2775b6"
								}
								if (response.data.data.data[i].flag == 5) {
									response.data.data.data[i].flag = "#8076a3"
								}

                if(response.data.data.data[i].status == 550){
                  if(response.data.data.data[i].platform_delivered_at && response.data.data.data[i].platform_delivered_at != null){

                  }else{
                    response.data.data.data[i].platform_delivered_at = '2023-11-21 00:00:00'
                  }

                  let a = moment();
                  let b = moment(response.data.data.data[i].platform_delivered_at);
                  let c = a.diff(b,'minutes')
                  if(c / (24*60) <= 5){
                    response.data.data.data[i].wu = true
                  }else{
                    response.data.data.data[i].wu = false
                  }
                }else{
                  response.data.data.data[i].wu = true
                }

							}

					this.datalist = response.data.data.data
					this.totalall=response.data.data.total
					this.ids()
					// this.abnormal_num=response.data.data.abnormal_num
					// this.produce_abnormal_num=response.data.data.produce_abnormal_num

				})



		},
		//获取手机号发验证码
			getshoujihao: function() {
				axios.get("/api/gth/my/shop/mobile")
					.then(response => {
						if (response.data.msg.code == 0) {
							this.mimashoujihao = response.data.data
						} else {
							this.$message.error(response.data.msg.info);
						}
					})
			},
		//选择标旗id
			choosecolorid: function(id, source_id) {
				//查看是否是拆单的
				this.amountchai = source_id

				this.chooseid = id
				this.flaglog = true
				axios.get('/api/plan-market/order/memo?id=' + id)
					.then(response => {
						this.flagarea = response.data.data.memo
						this.flagradio = response.data.data.flag
					})
			},
			//选择标旗确认
			flagloggo: function() {
				axios.post('/api/plan-market/order/flag', {
						color: this.flagradio,
						id: this.chooseid,
						memo: this.flagarea
					})
					.then(response => {
						this.loading = true
						this.flaglog = false
						this.getlist()
					})
			},
		//获取旗子
			getflag: function() {
				axios.get('/api/gth/shop/flag/info')
					.then(response => {

						for (var i in response.data.data) {

							if (response.data.data[i].type == 0) {
								response.data.data[i].color = "#e4dfd7"
							}
							if (response.data.data[i].type == 1) {
								response.data.data[i].color = "#ee3f4d"
							}
							if (response.data.data[i].type == 2) {
								response.data.data[i].color = "#ebb10d"
							}
							if (response.data.data[i].type == 3) {
								response.data.data[i].color = "#229453"
							}
							if (response.data.data[i].type == 4) {
								response.data.data[i].color = "#2775b6"
							}
							if (response.data.data[i].type == 5) {
								response.data.data[i].color = "#8076a3"
							}
						}

						this.flaglist = response.data.data
					})
			},
		//下载
			downDate: function() {
				const a = document.createElement('a');
				a.setAttribute('download', '上游订单导入模板.xlsx');
				a.setAttribute('href', this.url + 'static/sqdddr.xlsx');
				a.click();
			},
      downDate2: function() {
      	const a = document.createElement('a');
        a.setAttribute('download', '修改订单信息且重新上传模板.xlsx');
      	a.setAttribute('href', this.url + 'static/moban/xiugaiqiechongchuan.xlsx');
      	a.click();
      },
		//打开强制修改订单状态
		openxg(qzchangeid){
			this.upstream_id=qzchangeid
			this.xgshow=true
			this.qzradio=''
		},
		//提交强制修改
		upqzxg(){
			if(this.qzradio==''){
				this.$message.error('请选择修改状态');
			}else{
				this.$confirm('是否确认此操作?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
					}).then(() => {
						if(this.qzradio=='1'){
							this.suretype='470'
							axios.post('/api/plan-market/update/upstream/order/status', {
								upstream_id: this.upstream_id,
								reason: '',
								status:this.suretype
							}).then((response) => {
								if ( response.data.msg.code == 0) {
									this.$message({
										message: "操作成功",
										type: "success"
									});
									this.xgshow=false
								} else {
									this.$message.error(response.data.msg.info);
								}
							})
						}else if(this.qzradio=='2'){
							this.suretype='-460'
							this.qrsbshow = true
						}
					}).catch(() => {
						this.$message({
							type: 'info',
							message: '已取消'
						});
				});
			}


		},
		//获取渠道下拉
		getqdselect() {
			axios.get('/api/plan-market/upstream/channel/config/list', {
				params: {
					'y_name':'c_name'
				}
			})
				.then((response) => {


					this.qdList=response.data.data
				})
		},
		//获取所有产品下拉
		getcpselect() {
			axios.get('/api/gth/products?_page_size=10000')
				.then((response) => {

					this.cpselect = response.data.data.data
				})
		},
		//密码设置
			mimasetqueren: function() {
				if (this.mimaset != this.mimaset2) {
					this.$message.error("输入的密码不一致");
					return false
				}
				axios.post("/api/plan-market/shop/pwd", {
						mobile: this.mimashoujihao,
						sms_code: this.mimacode,
						password: this.mimaset
					})
					.then(response => {
						if (response.data.msg.code == 0) {
							this.$message.success("密码设置成功");
							this.mimasetlog = false
						} else {
							this.$message.error(response.data.msg.info);
						}
					})
			},
			//获取验证码
			getcode: function() {
				var that = this;
				var params = new URLSearchParams();
				params.append('mobile', this.mimashoujihao);
				axios.post('/api/auth/sms_code', params)
					.then(response => {
						if (response.data.msg.code == 0) {
							this.$message({
								message: '验证码已发送！',
								type: 'success'
							});
							that.daojishi()
						} else {
							this.$message.error(response.data.msg.info);
						}
					})
			},
			//倒计时功能
			daojishi: function() {
				var interval;
				interval = window.setInterval(() => {
					if (this.count <= 0) {
						window.clearInterval(interval)
						this.tishi = "获取验证码",
							this.jinyong = false
						this.count = 60
					} else {
						this.count -= 1;
						this.tishi = this.count + "秒重新获取"
						this.jinyong = true
					}
				}, 1000);
			},
			//重置密码确认
			mimaqueren2: function() {
				if (this.mimaset != this.mimaset2) {
					this.$message.error("输入的密码不一致");
					return false
				}
				axios.post("/api/plan-market/shop/pwd", {
						mobile: this.mimashoujihao,
						sms_code: this.mimacode,
						password: this.mimaset
					})
					.then(response => {
						if (response.data.msg.code == 0) {
							this.$message.success("密码设置成功");
							this.mimachongzhilog = false
						} else {
							this.$message.error(response.data.msg.info);
						}
					})
			},
		//获取物流公司
		getTrackCompany() {
			const that = this;
			axios
				.get("/api/plan-market/logistics-companies")
				.then(function (response) {

					const status = response.status;
					const data = response.data.data;
					const msg = response.data.msg;
					if (status === 200 && msg.code === 0) {
						that.trackCompanyList = data;
					} else {
						if (status !== 200) {
							that.$message.error("网络异常");
						} else {
							that.$message.error(msg.info);
						}
					}
				});
		},
		//确认密码下载
			mimaqueren: function() {
				// console.log(this.searchform.start_time)
				// console.log(this.searchform.end_time)
				// console.log(this.dateDays(this.searchform.start_time,this.searchform.end_time))
				// var cha_day = this.dateDays(this.searchform.start_time,this.searchform.end_time)
				// if(cha_day>15){
				// 	this.$message.error('只能导15天的订单 开始时间与结束时间差不超过15天');
				// }else{
				// 	this.exportInformation()

				// }
        this.exportInformation()

			},
			//计算相差天数，年月日时分秒
			dateDays(date1,date2){
				var sdate = new Date(date1);
				var now = new Date(date2);
				var days = now.getTime() - sdate.getTime();
				var day = parseInt(days / (1000 * 60 * 60 * 24));
				return day;
			},
			//导出信息
			exportInformation() {
				console.log('https://' + window.location.origin)
				this.daochuing = true
				this.daochuingz = "导出中..."
				if (this.productQuery) {
					this.search.product_id = this.productQuery.join(",");
				}

				this.searchform.password = this.mima
				axios.post('/api/plan-market/upstream/order/export', this.searchform).then(response => {
					if (response.data.msg.code == 0) {
						localStorage.setItem("daochumima",this.mima)
						// var a = document.createElement('a');
						// a.setAttribute('href', response.data.data);
						// a.click();
						this.daochuing = false
						this.daochuingz = "导出信息"
						// this.mimalog = false
						//2021.3.1全部导出修改
						// this.$router.push({
						//   path:'/order_export2'
						// })
						let routeData = this.$router.resolve({
							path: '/order_export3',query:{
								type:'zdsc'
							}
						});
						window.open(routeData.href, '_blank');
					} else {
						this.$message.error(response.data.msg.info);
						this.daochuing = false
						this.daochuingz = "导出信息"
					}

				})
			},
		//物流修改
		wuliuchange: function () {

			if (this.chooseorderlist.tracking_company_id == 1000) {
				this.wuliu0 = true
				this.chooseorderlist.tracking_number = "无需物流"
			} else {
				this.wuliu0 = false
				this.chooseorderlist.tracking_number = ""
			}
		},
		//复制功能
		copys: function (t) {
			var that = this
			this.$copyText(t)
				.then(
					res => {
						that.$message.success("复制成功");
					}
				);
		},
		//选择tab
		choosetab(i) {
			this.nowactive = i
			if(i==1){
				//全部订单
				this.searchform.flag=''
			}else if(i==2){
				//异常
				this.searchform.flag=1
			}else if(i==3){
				//异常
				this.searchform.flag=2
			}
			this.searchform.page=1
			//获取全部列表
			this.getlist()
      this.getshu()
		},
		//打开操作记录
		openczjl(con) {
			this.czjlshow = true
			this.czjltext=con
		},
		//打开确认失败
		openqrsb(upstream_id,suretype) {
			this.suretype=suretype
			this.upstream_id=upstream_id

			if(suretype=='470'){
				this.$confirm('确认上游订单成功', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					axios.post('/api/plan-market/update/upstream/order/status', {
						upstream_id: this.upstream_id,
						reason: '',
						status:this.suretype
					}).then((response) => {
						if ( response.data.msg.code == 0) {
							this.$message({
								message: "操作成功",
								type: "success"
							});
						} else {
							this.$message.error(response.data.msg.info);
						}
					})
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消'
					});
				});
			}else{
				this.qrsbshow = true
			}

		},
		//提交确认失败
		tjqrsb() {
			if (this.remark == "") {
				this.$message.error("请输入失败原因");
				return;
			}
			this.$confirm('该订单会出现在发展方订单处理-生产失败处，抖音订单会自动退款', '确认订单生产失败', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					axios.post('/api/plan-market/update/upstream/order/status', {
						upstream_id: this.upstream_id,
						reason: this.remark,
						status:this.suretype
					})
						.then((response) => {
							if ( response.data.msg.code == 0) {
								this.$message({
									message: "操作成功",
									type: "success"
								});
								this.qrsbshow = false
								this.xgshow=false

							} else {
								this.$message.error(response.data.msg.info);
							}
							this.remark = ''
						})
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消'
					});
				});


		},
		//打开录入生产数据
		openlrscsj(id) {
			this.lrscsjshow = true
			this.currentId = id
			axios
				.get("/api/plan-market/order/production?one=1&order_id=" + id)
				.then(response => {
					console.log(response);
					this.chooseorderlist = response.data.data;
					if (this.chooseorderlist.tracking_company_id == 1000) {
						this.chooseorderlist.tracking_company_id = String(this.chooseorderlist.tracking_company_id)
						this.wuliu0 = true
					} else {
						this.wuliu0 = false
						this.chooseorderlist.tracking_company_id = String(this.chooseorderlist.tracking_company_id)
					}
				});
		},
		//提交录入生产数据
		tjlrscsj() {
			const that = this;
			var data = {
				id: this.currentId,
				tracking_company_id: Number(this.chooseorderlist.tracking_company_id),
				plan_mobile_produced: this.chooseorderlist.plan_mobile_produced,
				tracking_number: this.chooseorderlist.tracking_number
			};
			axios
				.post("/api/plan-market/order/update_produce_data", data)
				.then((response) => {
					console.log(response);
					const status = response.status;
					const data = response.data;
					const msg = data.msg;
					console.log(response);
					if (status === 200 && msg.code === 0) {
						that.$message({
							message: "操作成功",
							type: "success"
						});
						this.lrscsjshow = false
						this.chooseorderlist.plan_mobile_produced = ''
						this.chooseorderlist.tracking_company_id = ''
						this.chooseorderlist.tracking_number = ''
					} else {
						if (status !== 200) {
							that.$message.error("网络异常");
						} else {
							that.$message.error(msg.info);
						}
					}
				})
				.catch(function (err) {
					that.$message.error("异常:" + err.message);
				});

		},
		//打开修改状态弹窗
		openxgzt(id) {
			this.currentId = id
			this.xgztshow = true
		},
		//提交修改状态
		tjxgzt() {
			const that = this;
			var data3 = {
				id: this.currentId,
				status: this.updatedS,
				remark: this.remarks
			};
			if (
				(this.updatedS == "-460" ||
					this.updatedS == "-200" ||
					this.updatedS == "0") &&
				this.remarks == ""
			) {
				that.$message.error("请填写备注");
				return;
			}
			axios
				.post("/api/plan-market/order/status/update", data3)
				.then(function (response) {
					console.log(response);
					const status = response.status;
					const data = response.data;
					const msg = data.msg;
					console.log(response);
					if (status === 200 && msg.code === 0) {
						that.$message({
							message: "操作成功",
							type: "success"
						});
						that.xgztshow = false
						that.remarks = "";
						that.updatedS = "";

					} else {
						if (status !== 200) {
							that.$message.error("网络异常");
						} else {
							that.$message.error(msg.info);
						}
					}
				})
				.catch(function (err) {
					that.$message.error("异常:" + err.message);
				});


		},
		//打开修改订单信息弹窗
		openxgddxx(id, source_id) {
			this.ischange = 0
			//查看是否是拆单的
			this.amountchai = source_id
			this.currentId = id
			this.xgddxxshow = true
			axios.get("/api/plan-market/order/production?one=1&order_id=" + id).then((response) => {

        this.old = JSON.parse(JSON.stringify(response.data.data))

				this.noworder.address_name = response.data.data.address_name
				this.noworder.id_card_name = response.data.data.id_card_name
				this.noworder.id_card_num = response.data.data.id_card_num
				this.noworder.address_mobile = response.data.data.address_mobile
				this.noworder.address_province = response.data.data.address_province
				this.noworder.address_city = response.data.data.address_city
				this.noworder.address_district = response.data.data.address_district

				this.noworder.address = response.data.data.address
        this.noworder.town = response.data.data.town
        this.noworder.address = this.noworder.address.replace(new RegExp(this.noworder.town, 'g'), '');


				this.noworder.address_province_code = response.data.data.address_province_code
				this.noworder.address_city_code = response.data.data.address_city_code
				this.noworder.address_district_code = response.data.data.address_district_code

        // order_id:this.currentId,
        // //老
        // sub_province:this.noworder.address_province,
        // sub_city:this.noworder.address_city,
        // sub_district:this.noworder.address_district,
        // //新
        // address_province:this.old.address_province,
        // address_city:this.old.address_city,
        // address_district:this.old.address_district,

				if (this.noworder.address_city_code == undefined) {
					this.handssq = true
				}
			})

		},
		//修改地址
		handleChange(value) {
			console.log(value);
			this.noworder.address_province_code = value[0];
			this.noworder.address_city_code = value[1];
			this.noworder.address_district_code = value[2];

			this.noworder.address_province = CodeToText[value[0]];
			this.noworder.address_city = CodeToText[value[1]];
			this.noworder.address_district = CodeToText[value[2]];

		},
		//提交修改订单信息
		tjxgddxx() {
			var that = this
			//是否选择同步
			if (this.tongbu) {
				this.noworder.same = 1
			} else {
				this.noworder.same = 0
			}
			this.noworder.id = this.currentId

      this.noworder.address  =  this.noworder.town + this.noworder.address

			axios.post("/api/plan-market/order/info/update", this.noworder)
				.then(function (response) {
					console.log(response);
					const status = response.status;
					const data = response.data;
					const msg = data.msg;
					console.log(response);
					if (status === 200 && msg.code === 0) {
						that.$message({
							message: "操作成功",
							type: "success"
						});
						that.xgddxxshow = false
						that.ischange = 2
					} else {
						that.ischange = 1
						if (status !== 200) {
							that.$message.error("网络异常");
						} else {
							that.$message.error(msg.info);
						}
					}
				})
				.catch(function (err) {
					that.$message.error("异常:" + err.message);
				});
		},
		//保存并提交上游
		tjxgddxxandtjsy(){
			var that = this
			this.tjxgddxx()
			var time = setInterval(()=>{
				if(this.ischange==1){
					clearInterval(time)
				}else if(this.ischange==2){
					clearInterval(time)
					// 重新提交至上游

					axios.post("/api/plan-market/message/order/retry", {
						id: this.currentId
					})
						.then(function (response) {
							if (response.data.msg.code == 0) {
								// that.zidongshengchanshibai()
								that.getlist()
								that.$message({
									type: 'success',
									message: '提交成功!'
								});
								this.newcxtjzsy=false
							} else {
								that.$message.error(response.data.msg.info);
							}
						})
					}
			},100)

		},
		downshuadan2: function () {

			const a = document.createElement('a');
			a.setAttribute('download', '重新提交上游.xlsx');
			a.setAttribute('href', this.url + 'static/moban/chongtishangyou.xlsx');
			a.click();
		},
		//批量导入生产数据
		exportData(data) {
			console.log(data)
			var that = this;
			var list = []
			that.daorulist=[]

			console.log(data.header[0])
			//导入提交上游订单ID数据
			if (data.header[0] == "提交上游订单ID") {
				for (var i = 0; i < data.results.length; i++) {
					list.push(data.results[i]['提交上游订单ID'])
				}

				if(this.nowactive==1){
					axios.post("/api/plan-market/upstream/order/force/submit", {
						ids: list
					})
					.then(function (response) {
						if (response.data.msg.code == 0) {
							that.daorulog = true
							that.daoruing = true
							// that.daoruok = response.data.data.success
							if(response.data.data!=''){
								that.daorulist = response.data.data.split(',')
								for (let i in that.daorulist) {
									that.daorulist[i] = '订单ID' + that.daorulist[i] + '失败'
								}
							}
							that.daoruing = false
							//获取全部列表
							that.getlist()
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
				}else if(this.nowactive==2){
          axios.post("/api/plan-market/message/order/retry/export", {
            order_ids: list
          })
					.then(function (response) {
						if (response.data.msg.code == 0) {
							that.daorulog = true
							that.daoruing = true
							// that.daoruok = response.data.data.success
							if(response.data.data!=''){
								that.daorulist = response.data.data.split(',')
								for (let i in that.daorulist) {
									that.daorulist[i] = '订单ID' + that.daorulist[i] + '失败'
								}
							}
							that.daoruing = false
							//获取全部列表
							that.getlist()
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
				}


			}else if (data.header[0] == "订单id") {
				var drdata = []
				for (var i = 0; i < data.results.length; i++) {
					drdata.push({order_id:data.results[i]['订单id'],reason:data.results[i]['失败原因']})
				}
				console.log(drdata)
				axios.post("/api/plan-market/import/upstream/order/info", {
					data: drdata
				})
					.then(function (response) {
						if (response.data.msg.code == 0) {
							that.daorulog = true
							that.daoruing = true
							// that.daoruok = response.data.data.success
							if(response.data.data.error!=''){
								that.daorulist = response.data.data.error
								for (let i in that.daorulist) {
									that.daorulist[i] =  that.daorulist[i]
								}
							}
							that.daoruing = false
							//获取全部列表
							that.getlist()
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			}else if (data.header[0] == "修改订单信息且重新上传的订单ID") {
				var drdata = []
				for (var i = 0; i < data.results.length; i++) {
					drdata.push({
            id:data.results[i]['修改订单信息且重新上传的订单ID'],
            id_name:data.results[i]['身份证名称'],
            id_num:data.results[i]['身份证号'],
            address:data.results[i]['收货地址'],
            mobile:data.results[i]['手机号'],
            province:data.results[i]['省'],
            city:data.results[i]['市'],
            district:data.results[i]['区']
          })
				}
				axios.post("/api/plan-market/producer/info/import", {
					data: drdata
				})
					.then(function (response) {
            console.log(response)
						if (response.data.msg.code == 0) {
							that.daorulog = true
							that.daoruing = true
							// that.daoruok = response.data.data.success
							if(response.data.data.error!=''){
								that.daorulist = response.data.data.errors
								for (let i in that.daorulist) {
									that.daorulist[i] =  that.daorulist[i]
								}
							}
							that.daoruing = false
							//获取全部列表
							that.getlist()
						} else {
							that.$message.error(response.data.msg.info);
						}
					})
			}
		},
		//查看详情
		seedetail: function(id) {
			window.open(window.location.origin +  window.location.pathname + "#/order_production/productDetail?id=" + id)
		},
		jiemi:function(item,index){
			this.$set(item,'id_card_name',this.decrypt(item.encrypt_id_card_name))
			this.$set(item,'id_card_num',this.decrypt(item.encrypt_id_card_num))
			this.$set(item,'address_name',this.decrypt(item.encrypt_address_name))
			this.$set(item,'address_mobile',this.decrypt(item.encrypt_address_mobile))
			this.$set(item,'address',this.decrypt(item.encrypt_address))

		},
		//查看证件
		seephoto: function(item) {

			this.jiemi(item)

			this.scsource_id = item.source_id
			this.waitpic = true;
			this.choose.id = item.id;
			this.choose.id_card_name = item.id_card_name;
			this.choose.id_card_num = item.id_card_num;
			this.seephotolog2 = true;
			this.choose.face = "";
			this.choose.back = "";
			this.choose.hand = "";


			axios.get("/api/plan-market/order/chargeStatus?id=" + this.scsource_id)
				.then(res => {
					if (res.data.msg.code != 0) {
						this.$message.error(res.data.msg.info);
					} else {
						console.log('----')
						console.log(res)
						this.urlStatus = res.data.data.type
						this.can_upload = res.data.data.show
					}
				});
			var that = this;
			axios
				.get(
					"/api/plan-market/order/photos/url?id_card_num=" +
					item.id_card_num +
					"&id=" +
					item.id
				)
				.then(response => {
					if (response.data.msg.code != 0) {
						that.$message.error(response.data.msg.info);
					} else {
						console.log('=====')

						console.log(response)
						var random = Math.random();
						if (response.data.data.face_url != "") {
							that.choose.face = response.data.data.face_url + "?v=" + random;
						} else {
							that.choose.face = "";
						}
						if (response.data.data.back_url != "") {
							that.choose.back = response.data.data.back_url + "?v=" + random;
						} else {
							that.choose.back = "";
						}
						if (response.data.data.hand_url != "") {
							that.choose.hand = response.data.data.hand_url + "?v=" + random;
						} else {
							that.choose.hand = "";
						}
					}
				});
		},
		//时间修改
		changetime(){
			console.log(this.longtime)
			this.searchform.start_time=this.longtime[0]
			this.searchform.end_time=this.longtime[1]
		},
		/**
     * 设置默认时间
     */
		getDefaultTime () {
			const end = new Date();
			const start = new Date();
			start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
			this.longtime[0] = this.timestampToTime(start)
			this.longtime[1] = this.timestampToTime(end)
			this.searchform.start_time=this.longtime[0]
			this.searchform.end_time=this.longtime[1]

		},
		timestampToTime(timestamp) {
            var chinaStandard=timestamp;
            var date = new Date(chinaStandard);
            var y = date.getFullYear();
            var m = date.getMonth() + 1;
            m = m < 10 ? ('0' + m) : m;
            var d = date.getDate();
            d = d < 10 ? ('0' + d) : d;
            var h = date.getHours();
            var minute = date.getMinutes();
            minute = minute < 10 ? ('0' + minute) : minute;
            var second = date.getSeconds();
            second = second < 10 ? ('0' + second) : second;
            var Time = y + '-' + m + '-' + d+' '+h+':'+minute+ ':' + second;
			return Time
        },
		//字符串转数组
		changestr(str){
			var arr = []
			if(str.indexOf('<br/>')==-1){
				arr = str.split('</br>')
			}else{
				arr = str.split('<br/>')
			}

			return arr[0]+'<br>'+arr[1]
		},
		//修改页码
		changepage(val){
			console.log(val)
			this.searchform.page=val
			//获取全部列表
			this.getlist()
		},
		//批量修改状态
		moreflag: function () {
			var arr = ""
			for (var i in this.danxuans) {
				console.log(this.danxuans[i])
				arr = arr + this.danxuans[i] + ","
			}
			arr = arr.substring(0, arr.lastIndexOf(','));
			if (this.fixstatus == "" || this.danxuans == "") {
				this.$message.error("请选择要修改的订单和状态");
				return false
			}


			axios.post('/api/gth/orders/handle', {
				status: this.fixstatus,
				ids: arr,
				status_memo: ''
			})
				.then(response => {
					if (response.data.msg.code == 0) {
						this.$message({
							message: '批量修改状态成功',
							type: 'success'
						});

						this.getlist()

						//事后清除一下

						this.fixstatus = ""
						this.arr = ""

						this.danxuans = []
						this.quanxuana = false
					} else {

						this.$message.error(response.data.msg.info);

					}
				})
		},
		//搜索
		searchlist(){
			this.searchform.page=1
			//获取全部列表
			this.getlist()
		},
		//全选的ids集合
		ids: function () {
			this.quanxuans=[]
			this.danxuans=[]
			this.quanxuana=false


			var checkids = []
			for (var i in this.datalist) {
				checkids.push(this.datalist[i].id)
			}
			this.quanxuans = checkids
		},
		//点击全选
		quanxuan: function () {
			if (this.danxuans.length != this.quanxuans.length || this.danxuans.length == 0) {
				this.danxuans = this.quanxuans
				this.quanxuana = true
				console.log('----')
				console.log(this.danxuans)
			} else {
				this.danxuans = []
				this.quanxuana = false
				console.log('--===--')
			}

		},
		//点击单选
		danxuan: function () {
			console.log(this.danxuans)
			// this.choosearea.push(this.checkedarea)
			if (this.danxuans.length == this.quanxuans.length) {
				this.quanxuana = true
			} else {
				this.quanxuana = false
			}
		},
		//导出异常订单
		dcorder(){


			this.$confirm('是否确认导出?', '提示', {
			confirmButtonText: '确定',
			cancelButtonText: '取消',
			type: 'warning'
			}).then(() => {
				// this.$message({
				// 	type: 'success',
				// 	message: '成功!'
				// });
				axios.post('/api/plan-market/upstream/order/export', {
					flag:1
					}).then(response => {
					if (response.data.msg.code == 0) {
						this.$message({
							type: 'success',
							message: '成功!'
						});
						let routeData = this.$router.resolve({
							path: '/order_export3',query:{
								type:'zdsc'
							}
						});
						window.open(routeData.href, '_blank');
					} else {
						this.$message.error(response.data.msg.info);
					}

				})
			}).catch(() => {
				this.$message({
					type: 'info',
					message: '已取消'
				});
			});

		},

		//新重新提交
		newchongxintijiao(id,channel_id,newsbreason,newtype,upstream_id){
			this.newcxid = id
			this.channel_id = channel_id
			this.newcxtjzsy=true
			this.newsbreason = newsbreason
			this.autocx = false
			this.newtype = newtype
			this.upstream_id = upstream_id
			if(newtype==1){
				this.newtitle = '确认订单生产失败'
			}else if(newtype==2){
				this.newtitle = '重新提交至上游'
			}
		},
		//是否选中永久设置
		changect(val){
			if(val){
				this.cjgz=true
			}
		},
		//确定永久设置
		sureset(newcxid,channel_id){
			var that = this
			if(this.newtype==1){
				// this.$confirm('该订单会出现在发展方订单处理-生产失败处，抖音订单会自动退款', '确认订单生产失败', {
				// 	confirmButtonText: '确定',
				// 	cancelButtonText: '取消',
				// 	type: 'warning'
				// }).then(() => {

				// }).catch(() => {
				// 	this.$message({
				// 		type: 'info',
				// 		message: '已取消'
				// 	});
				// });
				axios.post('/api/plan-market/update/upstream/order/status', {
						upstream_id: this.upstream_id,
						reason: this.newsbreason,
						status:'-460'
					}).then((response) => {
							if ( response.data.msg.code == 0) {
								this.$message({
									message: "操作成功",
									type: "success"
								});
								this.newcxtjzsy=false
								that.getlist()
							} else {
								this.$message.error(response.data.msg.info);
							}

						})
					if(this.autocx){
						axios.post("/api/plan-market/upstream/order/reason/save", {
							reason:this.newsbreason,
							type:1,
							operate:1,
							channel_id:channel_id
						})
					}
			}else if(this.newtype==2){
				//列表中重新提交
				this.chongxintijiao(newcxid,channel_id)
			}
		},
		//列表中重新提交
		chongxintijiao: function (id,channel_id) {
			this.$confirm('是否确认重新提交?', '提示', {
			confirmButtonText: '确定',
			cancelButtonText: '取消',
			type: 'warning'
			}).then(() => {
				var that = this
				axios.post("/api/plan-market/message/order/retry", {
					id: id
				})
					.then(function (response) {
						if (response.data.msg.code == 0) {
							// that.zidongshengchanshibai()
							that.getlist()
							that.$message({
								type: 'success',
								message: '提交成功!'
							});
							this.newcxtjzsy=false
						} else {
							that.$message.error(response.data.msg.info);
						}
					})

					// if(this.autocx){
					// 	axios.post("/api/plan-market/upstream/order/reason/save", {
					// 		reason:this.newsbreason,
					// 		type:1,
					// 		channel_id:channel_id,
					// 		operate:2,
					// 	})
					// }
			}).catch(() => {
			this.$message({
				type: 'info',
				message: '已取消'
			});
			});

		},
		//我们用这个改一下身份证信息咯
		changeIdCardMsg() {
			let params = {
				id: this.choose.id,
				id_card_name: this.choose.id_card_name,
				id_card_num: this.choose.id_card_num
			}
			axios.post("/api/plan-market/order/info/update", params)
				.then(response => {
					if (response.data.msg.code != 0) {
						this.$message.error(response.data.msg.info);
					} else {
						// this.loading = true;
						// this.$message.success("修改成功");
						this.getlist();
					}
				});
		},
		//我们用这个智能识别身份证信息咯
		getIdCardMsgByAI() {
			axios.get("/api/plan-market/order/fetchidcard?outer_id=" + this.scsource_id)
				.then(res => {
					if (res.data.msg.code != 0) {
						this.$message.error(res.data.msg.info);
					} else {
						this.choose.id_card_name = res.data.data.id_card_name;
						this.choose.id_card_num = res.data.data.id_card_num;
						// this.loading = true;
						// this.$message.success("修改成功");
						this.getlist();
					}
				});
		},
		//点击上传某张
		fixchoose: function(fbh) {
			this.which = fbh;
		},
		//单个图片上传
			uploadok: function(file) {

				var that = this;
				var formData = new FormData();
				formData.append("id_num", this.choose.id_card_num);
				formData.append("order_id", this.choose.id);
				formData.append("type", "plan");
				formData.append("pic[" + this.which + "]", file.raw);
				axios.post("/api/ROS/plan/photo/cut", formData).then(response => {
					if (response.data.msg.code != 0) {
						that.$message.error(response.data.msg.info);
					} else {
						//单张上传完之后 获取最新图片
						axios
							.get(
								"/api/plan-market/order/photos/url?id_card_num=" +
								this.choose.id_card_num +
								"&id=" +
								this.choose.id
							)
							.then(response => {
								if (response.data.msg.code != 0) {
									that.$message.error(response.data.msg.info);
								} else {
									var random = Math.random();
									if (response.data.data.face_url != "") {
										that.choose.face =
											response.data.data.face_url + "?v=" + random;
									} else {
										that.choose.face = "";
									}
									if (response.data.data.back_url != "") {
										that.choose.back =
											response.data.data.back_url + "?v=" + random;
									} else {
										that.choose.back = "";
									}
									if (response.data.data.hand_url != "") {
										that.choose.hand =
											response.data.data.hand_url + "?v=" + random;
									} else {
										that.choose.hand = "";
									}

								}
							});
					}
				});
			},
			//重传照片确定
			reppicgo: function() {
				var that = this;
				//调取更改状态
				axios.post("/api/plan-market/order/status/update", {
						id: this.choose.id,
						status: 120
					})
					.then(response => {
						if (response.data.msg.code != 0) {
							that.$message.error(response.data.msg.info);
						} else {


							that.$message({
								message: "订单已提交至初审",
								type: "success"
							});
							that.getlist();
							that.seephotolog2 = false;
						}
					});
			},
			copyurl: function() {
				if (!this.urlStatus) {
					return
				}
				let url = window.location.origin + '/'
				if (this.urlStatus === 'photos') {
					url = url + 'webapp/temporary/index.html'
				}
				if (this.urlStatus === 'idcodenum') {
					url = url + 'webapp/temporary/idCardNum.html'
				}

				var that = this;
				axios.get("/api/plan-market/getdunurl/?url=" + url + "?id=" + this.scsource_id, )
					.then(response => {
						if (response.data.msg.code == 0) {
							if (response.data.data != '') {
								that.$copyText(response.data.data).then(res => {
									that.$message.success("复制成功");
								});
							} else {
								this.$message.error('短链生成失败');
							}

						}
					});

			},
			//重新上传照片
			repeatphone(id){
				console.log(id)
				this.$confirm('是否确认重新提交?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					axios
					.post("/api/plan-market/upstream/order/upload/photo" ,{
						id:id,
						upstream_method:'uploadPhoto'
					})
					.then(response => {
						if ( response.data.msg.code == 0) {
							this.$message({
								message: "操作成功",
								type: "success"
							});
						} else {
							this.$message.error(response.data.msg.info);
						}
					});
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消'
					});
				});
			},
			//强制提交上游
			qzupdata(id){
				var arr = []
				arr.push(id)
				this.$confirm(`此订单已成功提交是否确定再次提交？<br><span style="color:red">注：此操作可能会造成订单2次生产</span>`, '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning',
					dangerouslyUseHTMLString: true
				}).then(() => {
					axios
					.post("/api/plan-market/upstream/order/force/submit" ,{
						ids:arr
					})
					.then(response => {
						if ( response.data.msg.code == 0) {
							this.$message({
								message: "操作成功",
								type: "success"
							});
						} else {
							this.$message.error(response.data.msg.info);
						}
					});
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消'
					});
				});
			},
			goxiazai: function() {
				let routeData = this.$router.resolve({
					path: '/order_export3',query:{
								type:'zdsc'
							}
				});
				window.open(routeData.href, '_blank');

				// this.$router.push({
				//   path:'/order_export2'
				// })
			},
			xiazai: function() {

				//判断有没有密码
				var that = this
				axios.get("/api/plan-market/shop/pwd")
					.then(function(response) {
						if (response.data.msg.code == 0) {
							console.log(response)
							if (response.data.data == "") {
								//要设置密码
								that.mimasetlog = true
							} else {
								//输入密码
								that.mimalog = true
							}
						} else {
							that.$message.error(response.data.msg.info);
						}
					});

				//没有密码设置  有密码下载
				//地址配置,用于下载模板
				// if(window.location.href.indexOf("91haoka_platform") > -1){
				// 	console.log("线上项目，谨慎操作。")
				// 	this.url = window.location.origin+"/"
				// }else{
				// 	this.url = ""
				// }
				// var a = document.createElement('a');

				// a.setAttribute('href', this.url+url);
				// a.click();
			},
			//批量提交
			repetup(){
				this.$confirm('是否确认重新提交上游?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
				}).then(() => {
					axios.post('/api/plan-market/message/order/retry/export', {
						order_ids: this.danxuans

					}).then(response => {
						console.log(response)
						if(response.data.msg.code==0){
							this.$message({
								type: 'success',
								message: '提交成功!'
							});
							this.danxuans = []
							this.quanxuana = false
						}else{
							this.$message.error(response.data.msg.info);
						}

					})

				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消'
					});
				});
			},
			//转
			waihu(id){

				// this.$router.push({path:'/callsystem/newcalls/waihuzhongxin/calldig',query:{orderid:id}})

				window.open(window.location.origin +  window.location.pathname+"#/callsystem/newcalls/waihuzhongxin/calldig?orderid="+id)
			}

	}

};
</script>
<style scoped lang="scss">
  .powertop {
  	display: flex;
  	background:#f9f9f9;
  }
  .powertopli {
  	flex-basis: 180px;
  	line-height: 50px;
  	border-bottom: 3px #F9F9F9 solid;
  	color: #727272;
  	border-right: 1px #F9F9F9 solid;
  	font-size: 16px;
  	text-align: center;
  }
  .router-link-active {
  	background: #FFFFFF;
  	border-bottom: 3px #2974FF solid;
  }
  .team {
  	background: #F9F9F9;
  }
 /deep/ .el-button--danger {
          color: #FFF;
          background-color: #2974FF;
          border-color: #2974FF;
      }
      /deep/ .el-date-editor .el-range-input{ background: rgb(247, 248, 250); }
      /deep/ .el-input__inner{ line-height: 36px; height: 36px; font-size: 12px; background: rgb(247, 248, 250);  border: 0;}
      /deep/ .el-button{ padding: 11px 23px !important;}
       input[type=checkbox] {
              cursor: pointer;
              position: relative;
          }

          input[type=checkbox]::after {
              position: absolute;
              top: 0;
              background-color: #fff;
              color: #fff;
              width: 14px;
              height: 14px;
              display: inline-block;
              visibility: visible;
              padding-left: 0px;
              text-align: center;
              content: ' ';
              border-radius: 2px;
              box-sizing: border-box;
              border: 1px solid #ddd;
          }

          input[type=checkbox]:checked::after {
              content: "";
              background-color: #2974FF;
              border-color: #2974FF;
              background-color: #2974FF;
          }

          input[type=checkbox]:checked::before {
              content: '';
              position: absolute;
              top: 1px;
              left: 5px;
              width: 3px;
              height: 8px;
              border: solid white;
              border-width: 0 2px 2px 0;
              transform: rotate(45deg);
              z-index: 1;
          }
.t_title {
	background-color: #F9F9F9;
	color: #727272;
	padding: 15px 25px;
}

.t_search_all {
	display: flex;
	flex-wrap: wrap;
}

.t_search_box {
	display: flex;
	align-items: center;
	margin-right: 20px;
	margin-top: 20px;

}

.t_search_title {
	width: 100px;
	text-align: right;
	padding-right: 10px;
	color: #727272;
	font-size: 14px;
}

.t_search_allbtn {
	display: flex;
	align-items: center;
	margin-left: 20px;
	margin-top: 20px
}

/deep/ .t_search_allbtn .el-input__inner {
	height: 40px !important;
	line-height: 40px !important;
}

.t_item_top {
	background-color: #F3FAFF;
	color: #646464;
	font-size: 14px;
	padding: 15px;
	display: flex;
	justify-content: space-between;
}

.t_item_cont {
	display: flex;
	border: 1px solid #EEEEEE;
	font-size: 14px;
	color: #646464;
  div{ line-height: 26px;}
}

.t_item_cont .el-button {
	padding: 0 !important;
	font-size: 14px;

}

.t_item_box {
	border-right: 1px solid #EEEEEE;
	padding: 20px;
	line-height: 20px;
	box-sizing: border-box;
}

.t_content {
	padding: 15px;
}

.t_headbox {
	display: flex;
	background-color: #F9F9F9;
	color: #646464;
	font-size: 14px;
	padding: 15px 0;
	text-align: center;
}

.t_tab_box {
	display: flex;
	// border-bottom: 2px solid #DCDCDC;
	color: #666;
	align-items: center;
}

.t_gray_line {
	height: 16px;
	border: 1px solid #AEAEAE;
}

.t_tab_item {
	padding: 10px 0px;
	// border-bottom: 2px solid white;
	cursor: pointer;
  width: 140px; text-align: center;
}

.t_tab_lei {
  position: relative;
  &::after{
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: #2974FF;
    left: 50%;
    margin-left: -10px;
    bottom:0
  }
	// border-bottom: 2px solid #2974FF;

  color: #2974FF !important;
}

.t_myform {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	margin-bottom: 10px
}

.t_cz_btnbox {
	/* display: flex;
	justify-content: end; */
	text-align: center;
}

.t_myform_title {
	width: 100px;
	text-align: right;
	padding-right: 5px;
}

.t_btn_box_all {
	display: flex;
}

/* /deep/ .t_btn_box_all .button_style {
	border: 1px solid #b3d8ff;
} */

/deep/ .t_btn_box_all #combtn .el-button--primary {
	color: #409EFF;
	background-color: #ecf5ff !important;
	border-color:#b3d8ff !important;
	padding:12px 23px !important;
  border-radius: 20px;
}
/* /deep/  .t_btn_box_all .order_production #drop .el-button--primary{
	border: 1px solid #b3d8ff;

} */

.reloadup {
	margin-left: 10px;
	margin-right: 10px;
}
.copyBtn {
		cursor: pointer;
		color: #409EFF;
		border: 1px #409EFF solid;
		padding: 5px;
		width: 160px;
		text-align: center;
		font-size: 14px;
		border-radius: 3px;
		margin-bottom: 20px;
	}
	.logflex {
			display: flex;
			justify-content: space-around;
			flex-wrap: wrap;


		}
.logflex .el-button--primary {
				padding: 10px 30px;
			}
		.logflex div {
			width: 377px;
			text-align: center;
		}

		.logflex .proimg {
			display: flex;
			justify-content: center;
			align-items: center;
			height: 265px;
			background: #eaeaea;
		}

		.logflex .proimg img {
			max-width: 100%;
			max-height: 100%;
		}
	.protitle {
			color: #197cff;
			cursor: pointer;
			margin-top: 10px;
		}
	/deep/ .t_fybox .el-input__inner{
		height: 28px !important;
		line-height: 28px !important;
	}
</style>

